package com.ks.core.framework.cpsupload.demos.orderpayinvoice.orderhandler;

import com.ks.core.framework.cpsupload.demos.orderpayinvoice.constant.OrderType;

import static com.ks.core.framework.cpsupload.demos.orderpayinvoice.constant.OrderType.*;

// 工厂模式：订单工厂
class OrderFactory {
    public static Order createOrder(OrderType type) {
        switch (type) {
            case CONF_REGISTRATION:
                return new ConferenceOrder();
            case HOTEL_BOOKING:
                return new HotelOrder();
            case TOUR_ROUTE:
                return new TourOrder();
            default:
                throw new IllegalArgumentException("无效订单类型");
        }
    }
}
